package com.ourteam.system.domain;

import net.dao.IDataPopulateCallback;

import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.lang.ArrayUtils;

import java.util.HashMap;

/**
 * Template Name : DTO数据对象
 * Template Version : 1
 * Template Last Modfiy Date : Thu Jul 12 16:34:06 CST 2018
 * Auto Generate Date : 2018-07-20 12:05:10
  * Warning ! This file will be overwrite when regenerate !
  *
 */
import java.util.Map;


public class SysUserSettingBean implements java.io.Serializable {
    private static Map<String, String> mappedDaoFields = new HashMap<String, String>();

    static {
        mappedDaoFields.put("id", com.ourteam.system.dao.ISysUserSettingDAO.Id);

        mappedDaoFields.put("userId",
            com.ourteam.system.dao.ISysUserSettingDAO.UserId);

        mappedDaoFields.put("itemName",
            com.ourteam.system.dao.ISysUserSettingDAO.ItemName);

        mappedDaoFields.put("itemValue",
            com.ourteam.system.dao.ISysUserSettingDAO.ItemValue);
    }

    private com.ourteam.system.dao.SysUserSetting sysUserSetting;

    public SysUserSettingBean() {
        super();

        this.sysUserSetting = new com.ourteam.system.dao.SysUserSetting();
    }

    public SysUserSettingBean(
        com.ourteam.system.dao.SysUserSetting sysUserSetting) {
        super();

        this.sysUserSetting = sysUserSetting;
    }

    protected BeanMap getBeanMap() {
        return new BeanMap(sysUserSetting);
    }

    public static String getMappedDAOField(String aAttrName) {
        return mappedDaoFields.get(aAttrName);
    }

    public com.ourteam.system.dao.SysUserSetting convertToSysUserSetting() {
        return this.sysUserSetting;
    }

    public com.ourteam.system.dao.SysUserSetting convertTo() {
        return this.sysUserSetting;
    }

    /**
     * Get id
     *
     * @return long
     */
    public long getId() {
        return (long) this.sysUserSetting.getId();
    }

    /**
     * Set id
     *
     * @parameter long
     */
    public void setId(long id) {
        this.sysUserSetting.setId(id);
    }

    /**
     * Get userId
     *
     * @return long
     */
    public long getUserId() {
        return (long) this.sysUserSetting.getUserId();
    }

    /**
     * Set userId
     *
     * @parameter long
     */
    public void setUserId(long userId) {
        this.sysUserSetting.setUserId(userId);
    }

    /**
     * Get itemName
     *
     * @return String
     */
    public String getItemName() {
        return (String) this.sysUserSetting.getItemName();
    }

    /**
     * Set itemName
     *
     * @parameter String
     */
    public void setItemName(String itemName) {
        this.sysUserSetting.setItemName(itemName);
    }

    /**
     * Get itemValue
     *
     * @return String
     */
    public String getItemValue() {
        return (String) this.sysUserSetting.getItemValue();
    }

    /**
     * Set itemValue
     *
     * @parameter String
     */
    public void setItemValue(String itemValue) {
        this.sysUserSetting.setItemValue(itemValue);
    }

    public int hashCode() {
        return org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(this);
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        } // end if

        if ((obj instanceof SysUserSettingBean) == false) {
            return false;
        } // end if

        SysUserSettingBean other = (SysUserSettingBean) obj;

        boolean isEqual = false;

        com.ourteam.system.dao.SysUserSetting tempSysUserSetting = other.convertToSysUserSetting();

        if ((tempSysUserSetting == null) || (this.sysUserSetting == null)) {
            isEqual = false;
        } else if ((tempSysUserSetting == this.sysUserSetting) ||
                tempSysUserSetting.equals(this.sysUserSetting)) {
            isEqual = true;
        } else {
            isEqual = false;
        }

        return isEqual;
    }

    public static SysUserSettingBean[] toArray(
        com.ourteam.system.dao.SysUserSetting[] aSysUserSettings) {
        return toArray(aSysUserSettings, null);
    }

    public static SysUserSettingBean[] toArray(
        com.ourteam.system.dao.SysUserSetting[] aSysUserSettings,
        IDataPopulateCallback aCallBack) {
        if (ArrayUtils.isEmpty(aSysUserSettings)) {
            return new SysUserSettingBean[0];
        }

        int length = aSysUserSettings.length;

        SysUserSettingBean[] beans = new SysUserSettingBean[length];

        for (int i = 0; i < length; i++) {
            beans[i] = new SysUserSettingBean(aSysUserSettings[i]);

            if (aCallBack != null) {
                aCallBack.populate(beans[i],
                    new Object[] { aSysUserSettings[i] });
            }
        }

        return beans;
    }
}
